import request from "@/utils/request";
import { IIdParams, IStatusParams, ITableListItem, SearchParams } from "./data";

// 列表
export async function queryList(params: SearchParams): Promise<any> {
	return request({
		url: "/nutrition/admin/permission/tree",
		method: "get",
		params,
	});
}

// 新增
export async function addItem(data: ITableListItem): Promise<any> {
	return request({
		url: "/nutrition/admin/permission",
		method: "post",
		data,
	});
}
//  状态
export async function editStatus(params: IStatusParams): Promise<any> {
	return request({
		url: `/adminApi/menu/updateHidden/${params.id}`,
		method: "post",
		params,
	});
}

// 删除
export async function deleteItem(params: IIdParams): Promise<any> {
	return request({
		url: "/nutrition/admin/permission",
		method: "delete",
		params,
	});
}

// 编辑
export async function editItem(data: ITableListItem): Promise<any> {
	return request({
		url: "/nutrition/admin/permission",
		method: "put",
		data,
	});
}

// 获取指定信息
export async function getItem(params: IIdParams): Promise<any> {
	return request({
		url: "/nutrition/admin/permission",
		method: "get",
		params,
	});
}
